﻿using System;
using System.ComponentModel;

namespace HalconDotNet
{
	/// <summary>Represents an instance of a socket connection.</summary>
	// Token: 0x02000064 RID: 100
	public class HSocket : HHandle
	{
		// Token: 0x06001813 RID: 6163 RVA: 0x0000883B File Offset: 0x00006A3B
		[EditorBrowsable(EditorBrowsableState.Never)]
		public HSocket() : base(HHandleBase.UNDEF)
		{
		}

		// Token: 0x06001814 RID: 6164 RVA: 0x0009AAFE File Offset: 0x00098CFE
		[EditorBrowsable(EditorBrowsableState.Never)]
		public HSocket(IntPtr handle) : base(handle)
		{
			this.AssertSemType();
		}

		// Token: 0x06001815 RID: 6165 RVA: 0x0009AB0D File Offset: 0x00098D0D
		[EditorBrowsable(EditorBrowsableState.Never)]
		public HSocket(HHandle handle) : base(handle)
		{
			this.AssertSemType();
		}

		// Token: 0x06001816 RID: 6166 RVA: 0x0009AB1C File Offset: 0x00098D1C
		private void AssertSemType()
		{
			base.AssertSemType("socket");
		}

		// Token: 0x06001817 RID: 6167 RVA: 0x0009AB29 File Offset: 0x00098D29
		internal static int LoadNew(IntPtr proc, int parIndex, int err, out HSocket obj)
		{
			obj = new HSocket(HHandleBase.UNDEF);
			return obj.Load(proc, parIndex, err);
		}

		// Token: 0x06001818 RID: 6168 RVA: 0x0009AB44 File Offset: 0x00098D44
		internal static int LoadNew(IntPtr proc, int parIndex, int err, out HSocket[] obj)
		{
			HTuple htuple;
			err = HTuple.LoadNew(proc, parIndex, err, out htuple);
			obj = new HSocket[htuple.Length];
			for (int i = 0; i < htuple.Length; i++)
			{
				obj[i] = new HSocket(HalconAPI.IsLegacyHandleMode() ? htuple[i].IP : htuple[i].H);
			}
			htuple.Dispose();
			return err;
		}

		/// <summary>
		///   Open a socket and connect it to an accepting socket.
		///   Modified instance represents: Socket number.
		/// </summary>
		/// <param name="hostName">Hostname of the computer to connect to. Default: "localhost"</param>
		/// <param name="port">Port number.</param>
		/// <param name="genParamName">Names of the generic parameters that can be adjusted for the socket. Default: []</param>
		/// <param name="genParamValue">Values of the generic parameters that can be adjusted for the socket. Default: []</param>
		// Token: 0x06001819 RID: 6169 RVA: 0x0009ABB4 File Offset: 0x00098DB4
		public HSocket(string hostName, int port, HTuple genParamName, HTuple genParamValue)
		{
			IntPtr proc = HalconAPI.PreCall(342);
			HalconAPI.StoreS(proc, 0, hostName);
			HalconAPI.StoreI(proc, 1, port);
			HalconAPI.Store(proc, 2, genParamName);
			HalconAPI.Store(proc, 3, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(genParamName);
			HalconAPI.UnpinTuple(genParamValue);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Open a socket and connect it to an accepting socket.
		///   Modified instance represents: Socket number.
		/// </summary>
		/// <param name="hostName">Hostname of the computer to connect to. Default: "localhost"</param>
		/// <param name="port">Port number.</param>
		/// <param name="genParamName">Names of the generic parameters that can be adjusted for the socket. Default: []</param>
		/// <param name="genParamValue">Values of the generic parameters that can be adjusted for the socket. Default: []</param>
		// Token: 0x0600181A RID: 6170 RVA: 0x0009AC28 File Offset: 0x00098E28
		public HSocket(string hostName, int port, string genParamName, string genParamValue)
		{
			IntPtr proc = HalconAPI.PreCall(342);
			HalconAPI.StoreS(proc, 0, hostName);
			HalconAPI.StoreI(proc, 1, port);
			HalconAPI.StoreS(proc, 2, genParamName);
			HalconAPI.StoreS(proc, 3, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Open a socket that accepts connection requests.
		///   Modified instance represents: Socket number.
		/// </summary>
		/// <param name="port">Port number. Default: 3000</param>
		/// <param name="genParamName">Names of the generic parameters that can be adjusted for the socket. Default: []</param>
		/// <param name="genParamValue">Values of the generic parameters that can be adjusted for the socket. Default: []</param>
		// Token: 0x0600181B RID: 6171 RVA: 0x0009AC90 File Offset: 0x00098E90
		public HSocket(int port, HTuple genParamName, HTuple genParamValue)
		{
			IntPtr proc = HalconAPI.PreCall(343);
			HalconAPI.StoreI(proc, 0, port);
			HalconAPI.Store(proc, 1, genParamName);
			HalconAPI.Store(proc, 2, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(genParamName);
			HalconAPI.UnpinTuple(genParamValue);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Open a socket that accepts connection requests.
		///   Modified instance represents: Socket number.
		/// </summary>
		/// <param name="port">Port number. Default: 3000</param>
		/// <param name="genParamName">Names of the generic parameters that can be adjusted for the socket. Default: []</param>
		/// <param name="genParamValue">Values of the generic parameters that can be adjusted for the socket. Default: []</param>
		// Token: 0x0600181C RID: 6172 RVA: 0x0009ACF8 File Offset: 0x00098EF8
		public HSocket(int port, string genParamName, string genParamValue)
		{
			IntPtr proc = HalconAPI.PreCall(343);
			HalconAPI.StoreI(proc, 0, port);
			HalconAPI.StoreS(proc, 1, genParamName);
			HalconAPI.StoreS(proc, 2, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Receive an image over a socket connection.
		///   Instance represents: Socket number.
		/// </summary>
		/// <returns>Received image.</returns>
		// Token: 0x0600181D RID: 6173 RVA: 0x0009AD54 File Offset: 0x00098F54
		public HImage ReceiveImage()
		{
			IntPtr proc = HalconAPI.PreCall(325);
			base.Store(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			int num = HalconAPI.CallProcedure(proc);
			HImage result;
			num = HImage.LoadNew(proc, 1, num, out result);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Send an image over a socket connection.
		///   Instance represents: Socket number.
		/// </summary>
		/// <param name="image">Image to be sent.</param>
		// Token: 0x0600181E RID: 6174 RVA: 0x0009AD9C File Offset: 0x00098F9C
		public void SendImage(HImage image)
		{
			IntPtr proc = HalconAPI.PreCall(326);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, image);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
			GC.KeepAlive(image);
		}

		/// <summary>
		///   Receive regions over a socket connection.
		///   Instance represents: Socket number.
		/// </summary>
		/// <returns>Received regions.</returns>
		// Token: 0x0600181F RID: 6175 RVA: 0x0009ADE0 File Offset: 0x00098FE0
		public HRegion ReceiveRegion()
		{
			IntPtr proc = HalconAPI.PreCall(327);
			base.Store(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			int num = HalconAPI.CallProcedure(proc);
			HRegion result;
			num = HRegion.LoadNew(proc, 1, num, out result);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Send regions over a socket connection.
		///   Instance represents: Socket number.
		/// </summary>
		/// <param name="region">Regions to be sent.</param>
		// Token: 0x06001820 RID: 6176 RVA: 0x0009AE28 File Offset: 0x00099028
		public void SendRegion(HRegion region)
		{
			IntPtr proc = HalconAPI.PreCall(328);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, region);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
			GC.KeepAlive(region);
		}

		/// <summary>
		///   Receive an XLD object over a socket connection.
		///   Instance represents: Socket number.
		/// </summary>
		/// <returns>Received XLD object.</returns>
		// Token: 0x06001821 RID: 6177 RVA: 0x0009AE6C File Offset: 0x0009906C
		public HXLD ReceiveXld()
		{
			IntPtr proc = HalconAPI.PreCall(329);
			base.Store(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			int num = HalconAPI.CallProcedure(proc);
			HXLD result;
			num = HXLD.LoadNew(proc, 1, num, out result);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Send an XLD object over a socket connection.
		///   Instance represents: Socket number.
		/// </summary>
		/// <param name="XLD">XLD object to be sent.</param>
		// Token: 0x06001822 RID: 6178 RVA: 0x0009AEB4 File Offset: 0x000990B4
		public void SendXld(HXLD XLD)
		{
			IntPtr proc = HalconAPI.PreCall(330);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, XLD);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
			GC.KeepAlive(XLD);
		}

		/// <summary>
		///   Receive a tuple over a socket connection.
		///   Instance represents: Socket number.
		/// </summary>
		/// <returns>Received tuple.</returns>
		// Token: 0x06001823 RID: 6179 RVA: 0x0009AEF8 File Offset: 0x000990F8
		public HTuple ReceiveTuple()
		{
			IntPtr proc = HalconAPI.PreCall(331);
			base.Store(proc, 0);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HTuple result;
			num = HTuple.LoadNew(proc, 0, num, out result);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Send a tuple over a socket connection.
		///   Instance represents: Socket number.
		/// </summary>
		/// <param name="tuple">Tuple to be sent.</param>
		// Token: 0x06001824 RID: 6180 RVA: 0x0009AF40 File Offset: 0x00099140
		public void SendTuple(HTuple tuple)
		{
			IntPtr proc = HalconAPI.PreCall(332);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, tuple);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(tuple);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Send a tuple over a socket connection.
		///   Instance represents: Socket number.
		/// </summary>
		/// <param name="tuple">Tuple to be sent.</param>
		// Token: 0x06001825 RID: 6181 RVA: 0x0009AF84 File Offset: 0x00099184
		public void SendTuple(string tuple)
		{
			IntPtr proc = HalconAPI.PreCall(332);
			base.Store(proc, 0);
			HalconAPI.StoreS(proc, 1, tuple);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Receive arbitrary data from external devices or applications using a generic socket connection.
		///   Instance represents: Socket number.
		/// </summary>
		/// <param name="format">Specification how to convert the data to tuples. Default: "z"</param>
		/// <param name="from">IP address or hostname and network port of the communication partner.</param>
		/// <returns>Value (or tuple of values) holding the received and converted data.</returns>
		// Token: 0x06001826 RID: 6182 RVA: 0x0009AFC0 File Offset: 0x000991C0
		public HTuple ReceiveData(HTuple format, out HTuple from)
		{
			IntPtr proc = HalconAPI.PreCall(333);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, format);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(format);
			HTuple result;
			num = HTuple.LoadNew(proc, 0, num, out result);
			num = HTuple.LoadNew(proc, 1, num, out from);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Receive arbitrary data from external devices or applications using a generic socket connection.
		///   Instance represents: Socket number.
		/// </summary>
		/// <param name="format">Specification how to convert the data to tuples. Default: "z"</param>
		/// <param name="from">IP address or hostname and network port of the communication partner.</param>
		/// <returns>Value (or tuple of values) holding the received and converted data.</returns>
		// Token: 0x06001827 RID: 6183 RVA: 0x0009B028 File Offset: 0x00099228
		public HTuple ReceiveData(string format, out string from)
		{
			IntPtr proc = HalconAPI.PreCall(333);
			base.Store(proc, 0);
			HalconAPI.StoreS(proc, 1, format);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			int num = HalconAPI.CallProcedure(proc);
			HTuple result;
			num = HTuple.LoadNew(proc, 0, num, out result);
			num = HalconAPI.LoadS(proc, 1, num, out from);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Send arbitrary data to external devices or applications using a generic socket communication.
		///   Instance represents: Socket number.
		/// </summary>
		/// <param name="format">Specification how to convert the data. Default: "z"</param>
		/// <param name="data">Value (or tuple of values) holding the data to send.</param>
		/// <param name="to">IP address or hostname and network port of the communication partner. Default: []</param>
		// Token: 0x06001828 RID: 6184 RVA: 0x0009B08C File Offset: 0x0009928C
		public void SendData(string format, HTuple data, HTuple to)
		{
			IntPtr proc = HalconAPI.PreCall(334);
			base.Store(proc, 0);
			HalconAPI.StoreS(proc, 1, format);
			HalconAPI.Store(proc, 2, data);
			HalconAPI.Store(proc, 3, to);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(data);
			HalconAPI.UnpinTuple(to);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Send arbitrary data to external devices or applications using a generic socket communication.
		///   Instance represents: Socket number.
		/// </summary>
		/// <param name="format">Specification how to convert the data. Default: "z"</param>
		/// <param name="data">Value (or tuple of values) holding the data to send.</param>
		/// <param name="to">IP address or hostname and network port of the communication partner. Default: []</param>
		// Token: 0x06001829 RID: 6185 RVA: 0x0009B0E4 File Offset: 0x000992E4
		public void SendData(string format, string data, string to)
		{
			IntPtr proc = HalconAPI.PreCall(334);
			base.Store(proc, 0);
			HalconAPI.StoreS(proc, 1, format);
			HalconAPI.StoreS(proc, 2, data);
			HalconAPI.StoreS(proc, 3, to);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Get the value of a socket parameter.
		///   Instance represents: Socket number.
		/// </summary>
		/// <param name="genParamName">Name of the socket parameter.</param>
		/// <returns>Value of the socket parameter.</returns>
		// Token: 0x0600182A RID: 6186 RVA: 0x0009B130 File Offset: 0x00099330
		public HTuple GetSocketParam(HTuple genParamName)
		{
			IntPtr proc = HalconAPI.PreCall(335);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, genParamName);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(genParamName);
			HTuple result;
			num = HTuple.LoadNew(proc, 0, num, out result);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Get the value of a socket parameter.
		///   Instance represents: Socket number.
		/// </summary>
		/// <param name="genParamName">Name of the socket parameter.</param>
		/// <returns>Value of the socket parameter.</returns>
		// Token: 0x0600182B RID: 6187 RVA: 0x0009B188 File Offset: 0x00099388
		public HTuple GetSocketParam(string genParamName)
		{
			IntPtr proc = HalconAPI.PreCall(335);
			base.Store(proc, 0);
			HalconAPI.StoreS(proc, 1, genParamName);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HTuple result;
			num = HTuple.LoadNew(proc, 0, num, out result);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Set a socket parameter.
		///   Instance represents: Socket number.
		/// </summary>
		/// <param name="genParamName">Name of the socket parameter.</param>
		/// <param name="genParamValue">Value of the socket parameter. Default: "on"</param>
		// Token: 0x0600182C RID: 6188 RVA: 0x0009B1D8 File Offset: 0x000993D8
		public void SetSocketParam(HTuple genParamName, HTuple genParamValue)
		{
			IntPtr proc = HalconAPI.PreCall(336);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, genParamName);
			HalconAPI.Store(proc, 2, genParamValue);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(genParamName);
			HalconAPI.UnpinTuple(genParamValue);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Set a socket parameter.
		///   Instance represents: Socket number.
		/// </summary>
		/// <param name="genParamName">Name of the socket parameter.</param>
		/// <param name="genParamValue">Value of the socket parameter. Default: "on"</param>
		// Token: 0x0600182D RID: 6189 RVA: 0x0009B228 File Offset: 0x00099428
		public void SetSocketParam(string genParamName, string genParamValue)
		{
			IntPtr proc = HalconAPI.PreCall(336);
			base.Store(proc, 0);
			HalconAPI.StoreS(proc, 1, genParamName);
			HalconAPI.StoreS(proc, 2, genParamValue);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Determine the HALCON data type of the next socket data.
		///   Instance represents: Socket number.
		/// </summary>
		/// <returns>Data type of next HALCON data.</returns>
		// Token: 0x0600182E RID: 6190 RVA: 0x0009B26C File Offset: 0x0009946C
		public string GetNextSocketDataType()
		{
			IntPtr proc = HalconAPI.PreCall(337);
			base.Store(proc, 0);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			string result;
			num = HalconAPI.LoadS(proc, 0, num, out result);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Get the socket descriptor of a socket used by the operating system.
		///   Instance represents: Socket number.
		/// </summary>
		/// <returns>Socket descriptor used by the operating system.</returns>
		// Token: 0x0600182F RID: 6191 RVA: 0x0009B2B4 File Offset: 0x000994B4
		public int GetSocketDescriptor()
		{
			IntPtr proc = HalconAPI.PreCall(338);
			base.Store(proc, 0);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			int result;
			num = HalconAPI.LoadI(proc, 0, num, out result);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>This operator is inoperable. It had the following function: Close all opened sockets.</summary>
		// Token: 0x06001830 RID: 6192 RVA: 0x0009B2FC File Offset: 0x000994FC
		public static void CloseAllSockets()
		{
			IntPtr proc = HalconAPI.PreCall(339);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.PostCall(proc, procResult);
		}

		/// <summary>
		///   Close a socket.
		///   Instance represents: Socket number.
		/// </summary>
		// Token: 0x06001831 RID: 6193 RVA: 0x0009B320 File Offset: 0x00099520
		public void CloseSocket()
		{
			IntPtr proc = HalconAPI.PreCall(340);
			base.Store(proc, 0);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Accept a connection request on a listening socket of the protocol type 'HALCON' or 'TCP'/'TCP4'/'TCP6'.
		///   Instance represents: Socket number of the accepting socket.
		/// </summary>
		/// <param name="wait">Should the operator wait until a connection request arrives? Default: "auto"</param>
		/// <returns>Socket number.</returns>
		// Token: 0x06001832 RID: 6194 RVA: 0x0009B354 File Offset: 0x00099554
		public HSocket SocketAcceptConnect(string wait)
		{
			IntPtr proc = HalconAPI.PreCall(341);
			base.Store(proc, 0);
			HalconAPI.StoreS(proc, 1, wait);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HSocket result;
			num = HSocket.LoadNew(proc, 0, num, out result);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Open a socket and connect it to an accepting socket.
		///   Modified instance represents: Socket number.
		/// </summary>
		/// <param name="hostName">Hostname of the computer to connect to. Default: "localhost"</param>
		/// <param name="port">Port number.</param>
		/// <param name="genParamName">Names of the generic parameters that can be adjusted for the socket. Default: []</param>
		/// <param name="genParamValue">Values of the generic parameters that can be adjusted for the socket. Default: []</param>
		// Token: 0x06001833 RID: 6195 RVA: 0x0009B3A4 File Offset: 0x000995A4
		public void OpenSocketConnect(string hostName, int port, HTuple genParamName, HTuple genParamValue)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(342);
			HalconAPI.StoreS(proc, 0, hostName);
			HalconAPI.StoreI(proc, 1, port);
			HalconAPI.Store(proc, 2, genParamName);
			HalconAPI.Store(proc, 3, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(genParamName);
			HalconAPI.UnpinTuple(genParamValue);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Open a socket and connect it to an accepting socket.
		///   Modified instance represents: Socket number.
		/// </summary>
		/// <param name="hostName">Hostname of the computer to connect to. Default: "localhost"</param>
		/// <param name="port">Port number.</param>
		/// <param name="genParamName">Names of the generic parameters that can be adjusted for the socket. Default: []</param>
		/// <param name="genParamValue">Values of the generic parameters that can be adjusted for the socket. Default: []</param>
		// Token: 0x06001834 RID: 6196 RVA: 0x0009B418 File Offset: 0x00099618
		public void OpenSocketConnect(string hostName, int port, string genParamName, string genParamValue)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(342);
			HalconAPI.StoreS(proc, 0, hostName);
			HalconAPI.StoreI(proc, 1, port);
			HalconAPI.StoreS(proc, 2, genParamName);
			HalconAPI.StoreS(proc, 3, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Open a socket that accepts connection requests.
		///   Modified instance represents: Socket number.
		/// </summary>
		/// <param name="port">Port number. Default: 3000</param>
		/// <param name="genParamName">Names of the generic parameters that can be adjusted for the socket. Default: []</param>
		/// <param name="genParamValue">Values of the generic parameters that can be adjusted for the socket. Default: []</param>
		// Token: 0x06001835 RID: 6197 RVA: 0x0009B480 File Offset: 0x00099680
		public void OpenSocketAccept(int port, HTuple genParamName, HTuple genParamValue)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(343);
			HalconAPI.StoreI(proc, 0, port);
			HalconAPI.Store(proc, 1, genParamName);
			HalconAPI.Store(proc, 2, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(genParamName);
			HalconAPI.UnpinTuple(genParamValue);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Open a socket that accepts connection requests.
		///   Modified instance represents: Socket number.
		/// </summary>
		/// <param name="port">Port number. Default: 3000</param>
		/// <param name="genParamName">Names of the generic parameters that can be adjusted for the socket. Default: []</param>
		/// <param name="genParamValue">Values of the generic parameters that can be adjusted for the socket. Default: []</param>
		// Token: 0x06001836 RID: 6198 RVA: 0x0009B4E8 File Offset: 0x000996E8
		public void OpenSocketAccept(int port, string genParamName, string genParamValue)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(343);
			HalconAPI.StoreI(proc, 0, port);
			HalconAPI.StoreS(proc, 1, genParamName);
			HalconAPI.StoreS(proc, 2, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Receive a serialized item over a socket connection.
		///   Instance represents: Socket number.
		/// </summary>
		/// <returns>Handle of the serialized item.</returns>
		// Token: 0x06001837 RID: 6199 RVA: 0x0009B544 File Offset: 0x00099744
		public HSerializedItem ReceiveSerializedItem()
		{
			IntPtr proc = HalconAPI.PreCall(403);
			base.Store(proc, 0);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HSerializedItem result;
			num = HSerializedItem.LoadNew(proc, 0, num, out result);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Send a serialized item over a socket connection.
		///   Instance represents: Socket number.
		/// </summary>
		/// <param name="serializedItemHandle">Handle of the serialized item.</param>
		// Token: 0x06001838 RID: 6200 RVA: 0x0009B58C File Offset: 0x0009978C
		public void SendSerializedItem(HSerializedItem serializedItemHandle)
		{
			IntPtr proc = HalconAPI.PreCall(404);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, serializedItemHandle);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
			GC.KeepAlive(serializedItemHandle);
		}
	}
}
